package com.naml.j_printstream;

import java.io.FileNotFoundException;
import java.io.OutputStream;
import java.io.PrintStream;

/**
 * @author marin
 * @version 1.0
 * @date 2025/4/25 20:05
 * @desc 字节打印流--打印流只有输出流！
 */
@SuppressWarnings("all")
public class PrintStream01 {
    public static void main(String[] args) {
        try {
            //打印到控制台显示器上
            PrintStream out = System.out;
            out.println("Hello World");

            //修改打印流的输出位置/设备
            System.setOut(new PrintStream("/Users/marin/new2.txt"));
            System.out.println("Hello World");//将会输出到文件中
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
}
